<template>
  <div
    class="first-list"
    @click="godetails"
  >
    <div class="container">
      <div class="img-box">
        <img :src="firstListData.cover">
        <div>{{firstListData.snumber}}次学习</div>
      </div>
      <div class="text-box">
        <div class="flex-l">{{firstListData.title}}</div>
        <div class="flex-r">
          <div>{{firstListData.count}}课</div>
          <div>
            <span>¥{{firstListData.money/100}}</span>
            <span>¥{{firstListData.preferential_money/100}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['firstListData'],
  created () {
    // console.log(this.firstListData)
  },
  methods: {
    godetails () {
      this.$emit('listcallback', this.firstListData)
    }
  },
  data () {
    return {

    }
  },
  components: {

  }
}
</script>
<style lang="less">
.first-list {
  width: 100%;
  padding: 10px 20px 10px 20px;
  box-sizing: border-box;
  .container {
    width: 100%;
    // height: 230px;
    box-sizing: border-box;
    // box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    .img-box {
      width: 100%;
      height: 180px;
      border-radius: 4px 4px 0 0;
      overflow: hidden;
      position: relative;
      img {
        width: 100%;
        height: 377 / 2px;
      }
      div {
        position: absolute;
        left: 0;
        top: 150px;
        height: 30px;
        line-height: 30px;
        background: rgba(0, 0, 0, 0.4);
        width: 100%;
        font-size: 12px;
        color: white;
        text-indent: 20px;
      }
    }
    .text-box {
      display: flex;
      flex-wrap: wrap;
      width: 100%;
      .flex-l {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 15px;
        color: #1a1a1a;
        flex: 0 0 100%;
        line-height: 28px;
      }
      .flex-r {
        flex: 0 0 100%;
        width: 100%;
        div {
          display: inline-block;
        }
        div:nth-of-type(1) {
          text-align: left;
          width: 49%;
          font-family: PingFangSC-Regular;
          font-size: 11px;
          color: #999999;
        }
        div:nth-of-type(2) {
          text-align: right;
          width: 50%;
        }
        span:first-of-type {
          color: #999999;
          font-size: 10px;
          text-decoration: line-through;
        }
        span:last-of-type {
          color: #DA4131;
          font-size: 14px;
        }
      }
    }
    .type {
      position: absolute;
      right: -25px;
      top: 6px;
      width: 80px;
      height: 20px;
      line-height: 20px;
      background: #29b7cb;
      -webkit-transform: rotate(45deg);
      transform: rotate(45deg);
      color: #fff;
      text-align: center;
    }
  }
}
</style>
